# -*- coding: utf-8 -*-
def load_blocked():
    with open('/Users/yinhaodong/PycharmProjects/demo1/game.txt') as f:
        global blocked_words
        blocked_words = []
        lines = f.readlines()
        for l in lines:
            if l:
                l=l.strip()
                blocked_words.append(l)

def words_filter(text,charset='utf-8',symbol='*'):
    for w in blocked_words:
        text = text.replace(w,symbol * len(w.encode(charset)))
    return text

if __name__ == '__main__':
    load_blocked()
    while True:
        t=input('请输入文字（回车直接退出）：\n')
        if not t:
            break
        print(words_filter(t))